# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-google-go-cmdtest
pkgver=0.4.0
pkgrel=1
pkgdesc="Simplifies testing of command-line interfaces"
arch=('any')
url="https://github.com/google/go-cmdtest"
license=('Apache')
depends=('go' 'golang-github-google-go-cmp' 'golang-github-google-renameio')
source=("$pkgname-$pkgver.tar.gz::https://github.com/google/go-cmdtest/archive/v$pkgver.tar.gz")
sha512sums=('5d467cdfb5355c459130f63abb0652919e9036fa83834a4bad38bbe9ccabec2f3644ac385686d6e1ff3f0a7af24d93f713400b619f82f95f9556dcad6de2032f')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/google
  cp -a "$srcdir"/go-cmdtest-$pkgver "$srcdir"/build/src/github.com/google/go-cmdtest
  cd "$srcdir"/build/src/github.com/google/go-cmdtest
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/google
  cp -a "$srcdir"/go-cmdtest-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/google/go-cmdtest
}
